{#
This file is part of EC-CUBE

Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.

http://www.ec-cube.co.jp/

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#}
{% extends 'default_frame.twig' %}

{% block title %}ホーム{% endblock %}

{% block javascript %}
<script>
$(function(){
    $('.order-summary-detail').click(function() {
        $('#admin_search_order_status').val($(this).attr('data-order-status'));
        $('#order-state').submit();
        return false;
    });
    $('.shop-stock-detail').click(function() {
        $('#shop-state-stock').submit();
        return false;
    });
    $('.shop-member-detail').click(function() {
        $('#shop-state-member').submit();
        return false;
    });
});
</script>
{% endblock javascript %}

{% block main %}
    {% if is_danger_admin_url %}
        <div class="row">
            <div class="alert alert-warning alert-dismissable alert-section">
                <button type="button" class="close" data-dismiss="alert"><span class="alert-close" aria-hidden="true">×</span></button>
                <svg class="cb cb-info-circle"> <use xlink:href="#cb-info-circle"></use></svg> 管理画面URLは、セキュリティのため推測されにくいものを設定してください。「<a href="{{ url('admin_setting_system_security') }}">セキュリティ管理</a>」から設定できます。
            </div>
        </div>
    {% endif %}
        <div class="row">
            <div class="col-md-6">
                <form id="order-state" name="form1" action="{{ url('admin_order') }}" method="post">
                {{ form_widget(searchOrderForm._token) }}
                <input type="hidden" id="admin_search_order_status" name="admin_search_order[multi_status]" value="">
                <div class="box" id="order_info">
                    <div class="box-header">
                        <h3 class="box-title">受注状況<a href="{{ url('admin_order') }}" class="icon_wrap"><svg class="cb cb-angle-right"> <use xlink:href="#cb-angle-right" /></svg></a></h3>
                    </div><!-- /.box-header -->
                    <div class="box-body no-padding no-border">
                        <div class="link_list">
                            <div class="tableish">
                                {% for OrderStatus in OrderStatuses %}
                                <a href="" class="item_box tr order-summary-detail" data-order-status="{{ OrderStatus.id }}">
                                    <div class="td">{{ OrderStatus.name }}</div>
                                    <div class="item_number text-right td">{{ Orders is not empty and Orders[OrderStatus.id] is defined ? Orders[OrderStatus.id] : 0 }}</div>
                                    <div class="icon_link td">
                                        <svg class="cb cb-angle-right"> <use xlink:href="#cb-angle-right" /></svg>
                                    </div>
                                </a><!-- /.item_box -->
                                {% endfor %}
                            </div>
                        </div>
                    </div><!-- /.box-body -->
                </div><!-- /.box -->
                </form>
            </div><!-- /.col -->

            <div class="col-md-6">
                <div class="box" id="cube_news">
                    <div class="box-header">
                        <h3 class="box-title">お知らせ</h3>
                    </div><!-- /.box-header -->
                    <div class="box-body no-padding no-border">
                        <iframe name="information" class="link_list_wrap" src="{{ app.config.eccube_info_url }}"></iframe>
                    </div><!-- /.box-body -->

                </div><!-- /.box -->
            </div><!-- /.col -->
        </div>

        <div class="row">
            <div class="col-md-8">
                <div class="box" id="sale_info">
                    <div class="box-header">
                        <h3 class="box-title">売り上げ状況</h3>
                    </div><!-- /.box-header -->
                    <div class="box-body no-padding no-border">
                        <div class="sale_box clearfix">
                            <div class="monthly_sale">
                                <div class="item_number">
                                    {{ salesThisMonth is empty ? '¥ 0' : salesThisMonth.order_amount|price }} / {{ salesThisMonth is empty ? 0 : salesThisMonth.order_count|number_format }} <span>件</span>
                                    <div class="small">今月の売上高 / 売上件数</div>
                                </div>
                            </div>
                            <div class="yesterday_sale">
                                <div class="item_number">
                                    {{ salesYesterday is empty ? '¥ 0' : salesYesterday.order_amount|price }} / {{ salesYesterday is empty ? 0 : salesYesterday.order_count|number_format }} <span>件</span>
                                    <div class="small">昨日の売上高 / 売上件数</div>
                                </div>
                            </div>
                            <div class="today_sale">
                                <div class="item_number">
                                    {{ salesToday is empty ? '¥ 0' : salesToday.order_amount|price }} / {{ salesToday is empty ? 0 : salesToday.order_count|number_format }}  <span>件</span>
                                    <div class="small">今日の売上高 / 売上件数</div>
                                </div>
                            </div>
                        </div>
                    </div><!-- /.box-body -->
                </div><!-- /.box -->
            </div><!-- /.col -->
            <div class="col-md-4">
                <div class="box" id="shop_info">
                    <div class="box-header">
                        <h3 class="box-title">ショップ状況</h3>
                    </div><!-- /.box-header -->
                    <div class="box-body no-padding no-border">
                        <form id="shop-state-stock" name="form2" action="{{ url('admin_homepage_nonstock') }}" method="post">
                            {{ form_widget(searchProductForm._token) }}
                        </form>
                        <form id="shop-state-member" name="form3" action="{{ url('admin_customer') }}" method="post">
                            {{ form_widget(searchCustomerForm._token) }}
                            <input type="hidden" id="admin_search_customer_status_1" name="admin_search_customer[customer_status]" value="2">
                        </form>
                        <div class="link_list">
                            <div class="tableish">
                                <a href="" class="item_box tr shop-stock-detail">
                                    <div class="icon td"><svg class="cb cb-tag-slash"><use xlink:href="#cb-tag-slash" /></svg></div>
                                    <div class="item_number td">{{ countNonStockProducts|number_format }}<div class="small">在庫切れ商品</div></div>
                                    <div class="icon_link td">
                                        <svg class="cb cb-angle-right"> <use xlink:href="#cb-angle-right" /></svg>
                                    </div>
                                </a><!-- /.item_box -->
                                <a href="" class="item_box tr shop-member-detail">
                                    <div class="icon td"><svg class="cb cb-users"><use xlink:href="#cb-users" /></svg></div>
                                    <div class="item_number text-left td">{{ countCustomers|number_format }}<div class="small">会員数</div></div>
                                    <div class="icon_link td">
                                        <svg class="cb cb-angle-right"> <use xlink:href="#cb-angle-right" /></svg>
                                    </div>
                                </a><!-- /.item_box -->
                            </div>
                        </div>
                    </div><!-- /.box-body -->
                </div><!-- /.box -->
            </div><!-- /.col -->
        </div>
{% endblock %}
